<!doctype html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../assert_selection.js"></script>
<script>
test(() => assert_selection(
    [
        '<div contenteditable>',
            '|<img src="../resources/abe.png">',
            '<img src="../resources/abe.png">',
            ' <img src="../resources/abe.png">',
        '</div>',
    ].join(''),
    selection => {
        selection.document.execCommand('insertText', false, 'a');
        selection.modify('move', 'forward', 'character');
        selection.document.execCommand('insertText', false, 'bcd');
        selection.modify('move', 'forward', 'character');
        selection.document.execCommand('insertText', false, 'efg');
        selection.modify('move', 'forward', 'character');
        selection.document.execCommand('insertText', false, 'hij');
        selection.modify('move', 'forward', 'character');
        selection.document.execCommand('insertText', false, 'klm');

    },
    [
        '<div contenteditable>',
            'a<img src="../resources/abe.png">',
            'bcd<img src="../resources/abe.png">',
            'efg\u{00A0}hij<img src="../resources/abe.png">',
            'klm|',
        '</div>',
    ].join('')),
    'insertText around image');
</script>
